package com.pengshun.modules.domain;


import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.annotation.Version;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 * @author shiguofeng on 2018/11/13  实体基类
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
public abstract class PsBaseEntity implements Serializable {
    /**
     * 创建时间 加了注解CreatedDate 后不用再代码手动设置时间了
     */
    @CreatedDate
    private Date createTime;
    /**
     * 修改时间 加了注解LastModifiedDate 后不用再代码手动设置时间了
     */
    @Version
    @LastModifiedDate
    private Date modifyTime;
    /**
     * 创建人
     */
    private String creator;
    /**
     * 修改
     */
    private String modifier;
}
